<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>书籍列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container">
    <div class="row clearfix">
        <div class="col-md-4 column"  >
            <a class="btn btn-primary"  href="${pageContext.request.contextPath}/bookIndex">返回</a>
        </div>
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>书籍列表 </small>
                </h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-4 column"  >
            <a class="btn btn-primary"  href="${pageContext.request.contextPath}/login/toAddBook">新增</a>
        </div>
        <div style="display: inline">
            <div style="display: inline-block">
                <form action="${pageContext.request.contextPath}/login/search" method="GET" >
                    <input type="text" name="keyword">
                    <input type="submit" value="根据书名搜索">
                </form>
            </div>
            <div style="display:inline-block">
                <form action="${pageContext.request.contextPath}/login/search2" method="GET" >
                    <input type="text" name="keyword">
                    <input type="submit" value="根据ID搜索">
                </form>
            </div>
        </div>
    </div>

    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>图书编号</th>
                    <th>图书名称</th>
                    <th>书籍数量</th>
                    <th>图书作者</th>
                    <th>图书乐行</th>
                    <th>价格</th>
                    <th>语言</th>
                    <th>操作</th>
                </tr>
                </thead>

                <tbody>
                <c:forEach var="book" items="${requestScope.get('one')}">
                    <tr>
                        <td>${book.getBookID()}</td>
                        <td>${book.getBookName()}</td>
                        <td>${book.getBookCounts()}</td>
                        <td>${book.getAuthor()}</td>
                        <td>${book.getBookType()}</td>
                        <td>${book.getPrice()}</td>
                        <td>${book.getBookLanguage()}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/login/toUpdateBook?id=${book.getBookID()}">更改</a>
                            |
                            <a href="${pageContext.request.contextPath}/login/del/${book.getBookID()}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>